#include <bits/stdc++.h>
using namespace std;

const int N = 2e5+5;
int a[N];
bool vis[N];

int main()
{
	int n;
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%d",&a[i]);
	int flag = n;
	while (flag)
	{
		for (int i=1; i<=n;) 
		{
			if (!vis[i])
			{
				flag--;
				printf("%d ",i);
				vis[i] = true;
				int j;
				for (j=i; j<=n; j++) 
					if (a[j] != a[i] && !vis[j]) break;
				i=j;
			}
			else i++;
		}
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
